﻿<?php
session_start();require('../conn.php');require('../functions.php');require('admin.php');$id=guolv($_GET['id']);$row=$mysql->query("select * from `rwsh` where `id`='{$id}'");
$_pic=str_replace('[weixin]','',$row[0]['pic']);
 
	 if($_POST){$id=guolv($_POST['id']);
	 $userid=guolv($_POST['userid']);
 
	 $money=guolv($_POST['money']);
	 $aid=guolv($_POST['aid']);
	  
	 $title=guolv($_POST['title']);
 
 	$sql="update `rwsh` set  `sh`=1  where `id`='{$id}'";
	if($_SESSION['admindata']['q']!='最高权限'){
		$sql=$sql." and rwuser=".$_SESSION['admindata']["id"] ;
		}
 
 
	 $mysql->execute($sql);
 
	 	 $mysql->execute("update `userdata` set  `money`=money+ {$money} where `id`='{$userid}'");
	 
	 $title2="完成任务:".$title;
	 
	 $mysql->query("insert into `refererdata` set uid='{$userid}',title='{$title2}',money={$money},day=now(),time=".time().""); 
	 
 
	 echo "<script>alert('审核成功');location.href='edit_rwsh.php?id={$id}'</script>";exit;}?>

<?php include('head.php')?>    
	<link rel="stylesheet" href="../editor/themes/default/default.css" />
	<link rel="stylesheet" href="../editor/plugins/code/prettify.css" />
	<script src="static/jquery.js" type="text/javascript"></script> 
	<script charset="utf-8" src="../editor/kindeditor.js"></script>
	<script charset="utf-8" src="../editor/lang/zh_CN.js"></script>
	<script charset="utf-8" src="../editor/plugins/code/prettify.js"></script>
	<script>
		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name="content"]', {
				cssPath : '../editor/plugins/code/prettify.css',
				uploadJson : '../editor/php/upload_json.php',
				fileManagerJson : '../editor/php/file_manager_json.php',
				allowFileManager : true,
				filterMode: false,//是否开启过滤模式
			});
			prettyPrint();
		});
	</script>
<script>
			KindEditor.ready(function(K) {
				var uploadbutton = K.uploadbutton({
					button : K('#uploadButton')[0],
					fieldName : 'imgFile',
					url : '../../editor/php/upload_json.php?dir=image',
					afterUpload : function(data) {
						if (data.error === 0) {
							var url = K.formatUrl(data.url, 'absolute');
							K('#img').val(url);
                            $.post("../../editor/php/dunling.php",{
                            url:url
                            },function(slta,sltb){
                            //****//
                            });
						} else {
							alert(data.message);
						}
					},
					afterError : function(str) {
						alert('自定义错误信息: ' + str);
					}
				});
				uploadbutton.fileBox.change(function(e) {
					uploadbutton.submit();
				});
			});
</script>	
    <div class="container-fluid">
        
        <div class="row-fluid">
		<?php
 include('left.php');?>
<div class="span9">
            <h1 class="page-title">任务审核</h1>
<!--			
<div class="btn-toolbar">
    <a href="#myModal" data-toggle="modal" class="btn">Delete</a>
  <div class="btn-group">
  </div>
</div>
-->
<div class="well">
 
      <div class="tab-pane active in" id="home">	  
		<form id="tab" action="edit_rwsh.php" method="post">
		<input type="hidden" name="title" value="<?php echo $row[0]['title']?>">
        
        	<input type="hidden" name="id" value="<?php echo $row[0]['id']?>">
       <input type="hidden" name="money" value="<?php echo$row[0]['money']?>"><input type="hidden" name="aid" value="<?php echo$row[0]['rwid']?>">
         <input type="hidden" name="userid" value="<?php echo $row[0]['user']?>">
		<label> <?php echo $row[0]['title']?> </label>
        <label> 佣金：<?php echo $row[0]['money']?> </label>
          <label> 用户：<?php echo $row[0]['user']?> </label>
         <label>说明：<?php echo $row[0]['nr']?> </label>
	   <label>  <?php if($row[0]['sh']==0){
		   echo "未审核";
		   }else{
			    echo "已审核";
			   
			   }?> </label>
	 
		 <label>
          <?php  if($row[0]['img1']!=""){?> 
          <a href="../<?php echo $row[0]['img1']?>" target="_blank"><img name="" src="../<?php echo $row[0]['img1']?>" width="100" height="100" alt=""></a>
          <?php }?> 
          
          
          
            <?php  if($row[0]['img2']!=""){?> 
            <a href="../<?php echo $row[0]['img2']?>" target="_blank"><img name="" src="../<?php echo $row[0]['img2']?>" width="100" height="100" alt=""></a>
          <?php }?> 
          
            <?php  if($row[0]['img3']!=""){?> 
            <a href="../<?php echo $row[0]['img3']?>" target="_blank"><img name="" src="../<?php echo $row[0]['img3']?>" width="100" height="100" alt=""></a>
          <?php }?> 
          
            <?php  if($row[0]['img4']!=""){?> 
            <a href="../<?php echo $row[0]['img4']?>" target="_blank"><img name="" src="../<?php echo $row[0]['img4']?>" width="100" height="100" alt=""></a>
          <?php }?> 
         </label>
         
            <?php  if($row[0]['sh']=="0"){?> 
		 <button class="btn btn-primary"><i class="icon-save"></i> 审核通过</button>
         
            <?php 
			
			
			
			 }?> 
		</form>
      </div>
  </div>
</div>

<div class="modal small hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Delete Confirmation</h3>
  </div>
  <div class="modal-body">
    
    <p class="error-text"><i class="icon-warning-sign modal-icon"></i>Are you sure you want to delete the user?</p>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
    <button class="btn btn-danger" data-dismiss="modal">Delete</button>
  </div>
</div>

        </div>
    </div>
    

    
    <footer>
        <hr>
        
        <p class="pull-right"><!--power by right--></p>
        
        
        <p><!--power by --></p>
    </footer>
    

    

    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="lib/bootstrap/js/bootstrap.js"></script>
  </body>
</html>